function Async(methodName, callback)
{
	this.Execute = function()
	{
		var request;
		var parameters = "?action=ajax&method=" + methodName;
		
		for (var i = 0; i < arguments.length; i++)
			parameters += '&p' + i + '=' + arguments[i];
		
		request = new Request(getPageUrl() + parameters, callback);
		
		request.Execute();
	}
	
	function getPageUrl()
	{
		var url = document.location.toString();
		var paramIndex = url.indexOf("?");
		
		if (paramIndex != -1)
			url = url.substring(0, paramIndex);
		
		return url;
	}
}

function Request(url, callback)
{
	var asyncRequest;
	
	this.Execute = function()
	{
		if (window.XMLHttpRequest) 
			asyncRequest = new XMLHttpRequest();
		else
			asyncRequest = new ActiveXObject("Msxml2.XmlHttp.3.0");
		
		asyncRequest.onreadystatechange = requestComplete;
		asyncRequest.open('GET', url, true);
		asyncRequest.send('');
	}
	
	function requestComplete()
	{
		if (asyncRequest.readyState == 4)
			callback(asyncRequest.responseText);
	}
}